home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1945 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: erich.triumf.ca!bennett
  2. From: bennett@erich.triumf.ca (P.Bennett)
  3. Newsgroups: comp.unix.osf.osf1,comp.lang.c
  4. Subject: Re: printf-problem
  5. Date: 17 Jan 1996 15:08 PST
  6. Organization: TRIUMF: Tri-University Meson Facility
  7. Distribution: world
  8. Message-ID: <17JAN199615080909@erich.triumf.ca>
  9. References: <4dj4g6$t9f@sunsystem5.informatik.tu-muenchen.de>
  10. NNTP-Posting-Host: ftp.triumf.ca
  11. News-Software: VAX/VMS VNEWS 1.50    
  12.  
  13. In article <4dj4g6$t9f@sunsystem5.informatik.tu-muenchen.de>, wist@lam.mw.tu-muenchen.de writes...
  14. >Hi Folks!
  15. >Got a little problem with printing large int's from a c-program.
  16. >Platform: Digital Alpha running DG-UX3.2
  17.  
  18. >long int zahl;   /* which is e.g. 10000500001 */
  19. >printf("%d\n",zahl);      /* gives 1410565409, which is definitly wrong */
  20.  
  21. >Is that a problem of printf() or DG-UX or is it my problem that I don't know
  22. >the right conversion for printf(). Btw, printf("%u",zahl) didn't work either.
  23. >Any suggestions?
  24.  
  25.  
  26. You have to tell printf() that  you are giving it a long.  try
  27.     printf("%ld"\n,zahl);
  28.  
  29. Peter Bennett VE7CEI                | Vessels shall be deemed to be in sight
  30. Internet: bennett@triumf.ca         | of one another only when one can be
  31. Packet: ve7cei@ve7kit.#vanc.bc.ca   | observed visually from the other
  32. TRIUMF, Vancouver, B.C., Canada     |                          ColRegs 3(k)
  33. GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.